<!DOCTYPE html>
<html>
<head>
    <title>历史查询</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

    <meta name="description" content="Write an awesome description for your new site here. You can edit this line in _config.yml. It will appear in your document head meta (for Google search results) and in your feed.xml site description.
">
      <link rel="stylesheet" href="../css/weui.css">
      <link rel="stylesheet" href="https://cdn.bootcss.com/jquery-weui/1.2.0/css/jquery-weui.min.css">
      <link rel="stylesheet" href="../css/demos.css">
      <link rel="stylesheet" href="https://cdn.bootcss.com/weui/0.4.3/style/weui.min.css" type="text/css">
    <style>
        .placeholder {
            margin: 5px;
            padding: 0 10px;
            background-color: #ebebeb;
            height: 2.3em;
            line-height: 2.3em;
            text-align: left;
            color: #cfcfcf;
        }
    </style>
	<script src="../js/jquery-2.1.4.js"></script>
<script>
    function getCookie(cname){
		  var name = cname + "=";
		  var ca = document.cookie.split(';');
		  for(var i=0; i<ca.length; i++) 
		  {
			var c = ca[i].trim();
			if (c.indexOf(name)==0) return c.substring(name.length,c.length);
		  }
		  return "";
	}
    var username=getCookie("school[username]");

	$.ajax({ 
	type : "GET",
	url: "../json/"+username+".json",
	dataType : "json",
	success: function(data){
		// 如果数据请求成功
		if(data.code = 200) {
			hotHtml(data);
		}
	}
});

// 填充数据到html节点中
  var hotHtml = function (data) {
	var html = '';
	for(i=0; i<data.length; i++) {
		html += '<div class="weui-form-preview__bd">' +
            '<div class="weui-form-preview__item">' +
            '<label class="weui-form-preview__label">选课时间</label><span class="weui-form-preview__value">'+data[i][5]+'</span></div>' +
            '<div class="weui-form-preview__item"><label class="weui-form-preview__label">教室</label><span class="weui-form-preview__value">'+data[i][1]+'</span></div>' +
            '<div class="weui-form-preview__item"><label class="weui-form-preview__label">课程内容</label><span class="weui-form-preview__value">'+data[i][3]+'</span></div>' +
            '<div class="weui-form-preview__item"><label class="weui-form-preview__label">状态</label><span class="weui-form-preview__value">'+data[i][6]+'</span></div>' +
            '</div>';
	}
	$("#hothtml").html(html);
} 
</script>
	
	
</head>

  <body ontouchstart>

    <header class='demos-header' style="padding-top: 20px;padding-bottom: 20px;">
      <h1 class="demos-title">历史课程</h1>
    </header>
   
    <div class="weui-form-preview">
	<ul id="hothtml">
    </ul>
	</div>
  <div class="weui-form-preview__ft">
        <a class="weui-form-preview__btn weui-form-preview__btn_primary" href="../firstPage.php">返回</a>
  </div>
  
  </body>
</html>
